package jmine.tec.di.metadata;

import jmine.tec.di.resolver.ObjectResolver;
import jmine.tec.di.scope.TypedScope;
import jmine.tec.di.type.TypeConvertionException;
import jmine.tec.di.wrapper.Wrapper;

/**
 * Representa uma dependencia
 * 
 * @author MarceloT
 */
public interface DependencyMetaData {

    /**
     * Nome da propriedade
     * 
     * @return {@link String}
     */
    String getPropertyName();

    /**
     * Se é uma propriedade obrigatória
     * 
     * @return boolean
     */
    boolean isRequired();

    /**
     * @param scope {@link TypedScope}
     * @return boolean
     */
    boolean isResolvable(TypedScope scope);

    /**
     * Resolve a dependencia, fazendo wrap se necessario
     * 
     * @param scope o {@link TypedScope}
     * @return Object
     * @throws TypeConvertionException e
     */
    Object resolveObjectWrap(TypedScope scope) throws TypeConvertionException;

    /**
     * @return the componentType
     */
    Class<?> getComponentType();

    DependencyMetaData[] EMPTY_ARRAY = {};

    /**
     * @return the resolver
     */
    ObjectResolver getResolver();

    /**
     * @return {@link Wrapper}
     */
    Wrapper getWrapper();
}
